<template>
  <div class="app-container home">
    <table class="pure-table pure-table-bordered">
      <thead>
        <tr>
          <th>#</th>
          <th>有效订单数</th>
          <th>营业额(元)</th>
          <th>推荐成交订单数</th>
          <th>推荐成交额(元)</th>
          <th>收入(元)</th>
        </tr>
      </thead>

      <tbody>
        <tr>
          <td>今日数据</td>
          <td>{{ today.totalNum ? today.totalNum : 0 }}</td>
          <td>￥{{ today.totalFee ? today.totalFee : 0 }}</td>
          <td>{{ today.recommendDealNum ? today.recommendDealNum : 0 }}</td>
          <td>￥{{ today.recommendDealFee ? today.recommendDealFee : 0 }}</td>
          <td>￥{{ today.incomeFee ? today.incomeFee : 0 }}</td>
        </tr>

        <tr>
          <td>系统总数据</td>
          <td>{{ total.totalNum ? total.totalNum : 0 }}</td>
          <td>￥{{ total.totalFee ? total.totalFee : 0 }}</td>
          <td>{{ total.recommendDealNum ? total.recommendDealNum : 0 }}</td>
          <td>￥{{ total.recommendDealFee ? total.recommendDealFee : 0 }}</td>
          <td>￥{{ total.incomeFee ? total.incomeFee : 0 }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<style scoped>
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

td,
th {
  padding: 0;
}

.pure-table {
  border-collapse: collapse;
  border-spacing: 0;
  empty-cells: show;
  border: 1px solid #cbcbcb;
}

.pure-table caption {
  color: #000;
  font: italic 85%/1 arial, sans-serif;
  padding: 1em 0;
  text-align: center;
}

.pure-table td,
.pure-table th {
  border-left: 1px solid #cbcbcb;
  border-width: 0 0 0 1px;
  font-size: inherit;
  margin: 0;
  overflow: visible;
  padding: .5em 1em;
}

.pure-table thead {
  background-color: #e0e0e0;
  color: #000;
  text-align: left;
  vertical-align: bottom;
}

.pure-table td {
  background-color: transparent;
}

.pure-table-bordered td {
  border-bottom: 1px solid #cbcbcb;
}

.pure-table-bordered tbody>tr:last-child>td {
  border-bottom-width: 0;
}
</style>
<script>

import { getIndexCount } from "@/api/system/index";

export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "3.8.7",
      total: {},
      today: {}
    };
  },
  created() {
    this.initCurrPage()
  },
  methods: {
    initCurrPage() {
      getIndexCount().then(res => {
        this.total = res.data.total
        this.today = res.data.today
      })
    },
    goTarget(href) {
      window.open(href, "_blank");
    }
  }
};
</script>

